package br.unifor.aspect;


import br.unifor.onto.ServiceHelper;

import com.hp.hpl.jena.enhanced.EnhGraph;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.shared.PropertyNotFoundException;
import com.hp.hpl.jena.ontology.impl.OntResourceImpl;


public class OntologyResource extends OntResourceImpl {
	public OntologyResource(Node arg0, EnhGraph arg1) {
		super(arg0, arg1);
		// TODO Auto-generated constructor stub
	}
	
	public RDFNode getPropertyValue( Property property )
	{
		try
		{
			System.out.println( "Interceptando..." );

			try
			{
				if ( ServiceHelper.existActivelowlAnnotation( property ) )
					return ServiceHelper.invokeService( (Individual) this,
						property );
			}
			catch ( Exception e )
			{
				e.printStackTrace();
			}

			return getRequiredProperty( property ).getObject();
		}
		catch ( PropertyNotFoundException ignore )
		{
			return null;
		}
	}
}
